package com.example.administrator.wallet.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.example.administrator.wallet.R;
import com.example.administrator.wallet.view.activity.AgainBackupsActivity;

import java.util.List;

/**
 * Effect:
 * <p>
 * Author:  CaiYapeng
 * <p>
 * Time  :  2018/7/10.
 */

public class AgainBackupsGridAdapter extends BaseAdapter {
    private Context context;
    private List<String> datas2;

    public AgainBackupsGridAdapter(AgainBackupsActivity againBackupsActivity, List<String> datas2) {
        this.context = againBackupsActivity;
        this.datas2 = datas2;
    }

    @Override
    public int getCount() {
        return datas2.size();
    }

    @Override
    public Object getItem(int i) {
        return null;
    }

    @Override
    public long getItemId(int i) {
        return 0;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        ViewHolder holder;
        if (view == null) {
            holder = new ViewHolder();
            view = View.inflate(context, R.layout.backups_grid_item, null);
            view.setTag(holder);
        } else {
            holder = (ViewHolder) view.getTag();
        }
        holder.content = (TextView) view.findViewById(R.id.content);
        holder.content.setBackground(context.getResources().getDrawable(R.drawable.againbackups_grid_bg));
        holder.content.setText(datas2.get(i));
        return view;
    }

    public class ViewHolder {
        private TextView content;
    }
}
